-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set Golang version in Dockerfile #132
Set Golang version in Dockerfile #132
Conversation
Directly install a desired Go version instead of first installing what the builder image provides, and then using Golang CLI to get the desired version. It stems from an error we have seen in building the contianer at post-submit job
Skipping CI for Draft Pull Request. |
/test 4.15-openshift-e2e |
Dockerfile
Outdated
@@ -1,19 +1,28 @@ | |||
# Build the manager binary | |||
FROM quay.io/centos/centos:stream8 AS builder | |||
RUN dnf install -y golang git \ | |||
RUN dnf install -y golang jq git \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove golang
4b455d4
to
3c785ea
Compare
Dockerfile
Outdated
RUN GO_VERSION=$(grep -E "go [[:digit:]]\.[[:digit:]][[:digit:]]" go.mod | awk '{print $2}') \ | ||
&& dnf install golang-1.21.7 git -y && go version \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why extract GO_VERSION if we always install 1.21.7
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was for testing :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of using the patch version in go.mod isn't supported in Golang v1.20 and below, so I will introduce it in #133
3c785ea
to
a324327
Compare
Redundant step, and Golang desired version will be installed afterward from official page
a324327
to
0dbee7c
Compare
/test 4.15-openshift-e2e |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: razo7, slintes The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cherry-pick release-0.3 |
@razo7: new pull request created: #134 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Why we need this PR
Fix the way we set the Golang version in the Dockerfile.
See the below error from post-submit job that blocks the container build, of the pushed code (after merging PR or setting new tag), and eventually pushing it to Quay.
It tries to use Golang v1.21 (latest installed Golang version) for installing Golang v1.20.
Changes made
Directly install a desired Go version instead of first installing what the builder image provides, and then using Golang CLI to get the desired version. It stems from an error we have seen in building the contianer at the post-submit job
Which issue(s) this PR fixes
No issues, but an error from post-submit job